const BASE_URL = "https://www.fastmock.site/mock/558435845553113fdd01272d35f5e241/home";
interface ParamType{
[propname:string]:any;
}
const http = {
    get(url:string,parmas?:ParamType){
        if(parmas){
            const arr = Object.keys(parmas);
            const str = arr.map((i)=>i + '=' + parmas[i]);
            url +='?'+ str.join('&');
        }
        return fetch(BASE_URL + url)
        .then((Response)=>Response.json())
        .then((res)=>{
            if(res.status==="0"){
                // console.log(res);
               return res;
            }
        });
    },
}

export default http;